@import './colors';
@import './font';
@import './mixins';

.outline-reader {
  &__progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 3;
    height: 4px;
    width: 100%;
    background-color: @primary_color;
    scale: 0 1;
    transform-origin: left;
    animation: outline-reader-progress linear;
    animation-timeline: --ProgressTimeline;
  }

  &__paper {
    .shadow_dark_regular();
    margin: 2em auto;
    max-width: 1200px;
    padding: 3.2em;
    box-sizing: border-box;
    background-color: @white;
    overflow: hidden;
  }

  &__title {
    margin: 0.67em 0;
    text-align: center;
    font-family: @font_text_family;
    font-weight: normal;
    line-height: 1.3em;
    font-size: 4.2em;
    overflow: hidden;
  }

  &__article {
    .outline-reader__progress {
      display: none;
    }
  }

  &_hidden {
    display: none;

    &.outline-reader_sibling {
      display: none !important;

      &.wrapper {
        &.post {
          display: none;
        }
      }
    }
  }

  &--reading {
    display: block;
    position: fixed;
    z-index: 2;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    box-sizing: border-box;
    padding: 3em 4em;
    background-color: @bg_color;
    scroll-timeline-name: --ProgressTimeline;
    overflow: scroll;
  }
}

@keyframes outline-reader-progress {
  to {
    scale: 1 1;
  }
}

@media (max-width: 500px) {
  .outline {
    &-reader {
      overflow: hidden;

      .outline-toolbar {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        align-self: auto;
        top: 100%;
        right: 0;
        transform: translateY(-48px);
        width: 100%;
        height: 48px;
        box-sizing: border-box;
        border-top: 1px solid @border_color;
        background-color: @white;
        padding: 0 16px;

        &__button {
          .radius_none();
          flex: 1;
          border: none;
          box-shadow: none;
        }
      }

      &--reading {
        padding: 0;
        background-color: @white;
        box-sizing: border-box;
      }

      &__paper {
        position: relative;
        z-index: 1;
        margin: 0;
        padding: 0;
        height: 100%;
        box-shadow: none;
        overflow: hidden;
      }

      &__title {
        .ellipsis(1);
        position: absolute;
        z-index: 3;
        top: 0;
        left: 0;
        margin: 0;
        width: 100%;
        height: 48px;
        line-height: 48px;
        border-bottom: 1px solid @border_color;
        font-size: 1.8em;
        font-weight: 400;
        background-color: @white;
        overflow: hidden;
      }

      &__article {
        margin: 48px 0;
        height: calc(100% - 96px);
        padding: 0 1.25em;
        scroll-timeline-name: --MobileProgressTimeline;
        overflow-x: hidden;
        overflow-y: scroll;

        .outline-reader__progress {
          z-index: 4;
          animation: outline-reader-progress linear;
          animation-timeline: --MobileProgressTimeline;
          display: block;
        }
      }
    }
  }
}

@media print {
  html,
  body {
    height: initial !important;
  }

  .outline {
    &-message,
    &-toolbar {
      display: none !important;
    }

    &-reader {
      display: block !important;
      overflow: hidden;

      &__title {
        margin: 13.4pt 0 28pt !important;
        text-align: center !important;
        font-size: 32pt !important;
      }

      &--reading {
        position: relative !important;
        height: auto !important;
        padding: 0 !important;
        background-color: @white;
        overflow: hidden !important;
      }

      &__progress {
        display: none !important;
      }

      &__paper {
        box-shadow: none;
      }

      pre {
        padding: 1em !important;
        border: 1px solid @border_color !important;
        border-radius: 4px !important;
      }

      pre,
      code {
        background-color: @white !important;
      }

      table,
      img,
      svg {
        break-inside: avoid;
      }

      &_sibling {
        display: none !important;
      }
    }
  }
}
